package com.amazon.spapi.service;

import com.amazon.spapi.ApiException;
import com.amazon.spapi.api.OrdersV0Api;
import com.amazon.spapi.orders.GetOrdersResponse;
import com.amazon.spapi.orders.OrderList;
import com.amazon.spapi.values.AmazonAuthorConfigDTO;

import java.util.ArrayList;
import java.util.List;

/**
 * AmazonService
 *
 * @author Kim.Jin
 */
public class AmazonService {

    public OrderList getAmazonOrders(OrdersV0Api ordersV0Api, List<String> marketplaceIds, AmazonAuthorConfigDTO authorConfigDTO) throws ApiException {
        List<String> fulfillmentChannels = new ArrayList<>();
        fulfillmentChannels.add("MFN");
        List<String> orderStatuses = new ArrayList<>();
        orderStatuses.add("Unshipped");
        GetOrdersResponse response = ordersV0Api.getOrders(marketplaceIds,"2021-03-17T18:00:00","2021-03-18T18:00:00",null,
                null,null,null,null,null,null,10,
                null,null,null);
        if(null == response) {
            throw new RuntimeException();
        }
        System.out.println(response.getPayload().getOrders());
        return response.getPayload().getOrders();
    }
}
